<template>
  <div class="like-page">
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="----我是有底线的----"
      @load="onLoad"
    >
      <article-item v-for="item in list" :key="item.id" :item="item"/>
    </van-list>
  </div>
</template>

<script>
import { optListAPI } from '@/api/artcile'
export default {
  name: 'like-page',
  data () {
    return {
      list: [],
      loading: false,
      finished: false,
      page: 1
    }
  },
  methods: {
    async onLoad () {
      const res = await optListAPI({
        optType: 1,
        pageSize: 10,
        page: this.page
      })
      this.page++
      this.list.push(...res.data.rows)

      this.loading = false

      if (this.list.length >= res.data.total) {
        this.finished = true
      }
    }
  }
}
</script>

<style lang="less" scoped>
.like-page {
  margin-bottom: 50px;
  margin-top: 44px;
}
</style>
